﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<User>" %>

<script type="text/javascript">
    function loadPasswordControl() {
        $.ajax({
                url: '<%:Url.RouteUrl("Default",
                                           new {controller = "Passwords", action = "Generate", id = Model.UserId})%>',
                success: function(data) {
                    $('#userPassword').replaceWith(data);
                }
            });
    }
</script>

<span id="userPassword">
<%
    if (Model.Password != null)
    {%>
    <span class="smallgreytext">Есть</span>
<%
    } %>
<%
    else
    {%>
    <span class="smallredtext">Нет</span>
<%
    }%>
<span><a href="javascript:void(0)" onclick=' loadPasswordControl(); '>Сгенерировать новый</a> </span>
</span>
